using System;
using System.Collections;
using System.DirectoryServices;

namespace BEGDC.CC.Entity
{
	#region Application

	/// <summary>
	/// Application object for NHibernate mapped table 'Application'.
	/// </summary>
	[Serializable]
	public class Application : System.IComparable
		{
		#region Member Variables
		
		protected int _id;
		protected string _appNo;
		protected string _applicationType;
		protected string _eZVisitReqNo;
		protected string _lGDNo;
		protected string _requesterNameCN;
		protected string _requesterNameEN;
		protected string _requesterDept;
		protected string _account;
		protected string _cATBranch;
		protected string _requesterOfficeTel;
		protected string _requesterMobile;
		protected bool _applyForSomeoneElse;
		protected string _someoneElseHRID;
		protected string _someoneElseNameCN;
		protected string _someoneElseNameEN;
		protected string _someoneElseTel;
		protected string _someoneElseMobil;
		protected string _someoneElseEmail;
		protected bool _isReviewedGuideline;
		protected string _otherSite;
		protected string _otherCountry;
		protected Nullables.NullableDateTime _requestedDateFrom;
		protected Nullables.NullableDateTime _requestedDateTo;
		protected Nullables.NullableDateTime _alternateDateFrom;
		protected Nullables.NullableDateTime _alternateDateTo;
		protected string _activity;
		protected bool _isTransition;
		protected string _others;
		protected string _summary;
		protected string _allDept;
		protected bool _isDomestic;
		protected string _domesticList;
		protected string _overseaList;
		protected Nullables.NullableDateTime _requestDate;
		protected string _eRPNO;
		protected bool _isSSME;
		protected bool _isEBD;
		protected bool _isESC;
		protected bool _bUHeadApproved;
		protected bool _needEVPApproval;
		protected string _costCenterName;
		protected string _reasonOfLocation;

		protected Employee _requesterNo;
		protected DicItem _costCenterCode;
		protected Employee _someoneElseNo;
		protected LegalEntity _legalEntity;
		protected Department _departmentName;
		protected DicItem _departmentType;
		protected IList _paymentInfos;
		protected IList _customerSurveys;
		protected IList _logisticalInfos;
		protected IList _topicses;
		protected IList _emails;
		protected IList _customerInfos;
		protected IList _contractInfos;
		protected IList _businessPurposes;
		protected IList _attachments;
		protected IList _flowMembers;
		protected IList _appVisitingSites;
		protected IList _aLAttendees;
		protected IList _salesTeamInfos;
		protected IList _flowInstances;
		protected IList _eVMeetings;
		protected IList _actionLogs;
		protected static String _sortExpression = "Id";
		protected static SortDirection _sortDirection = SortDirection.Ascending;

		#endregion

		#region Constructors

		public Application() { }

		public Application( string appNo, string applicationType, string eZVisitReqNo, string lGDNo, string requesterNameCN, string requesterNameEN, string requesterDept, string account, string cATBranch, string requesterOfficeTel, string requesterMobile, bool applyForSomeoneElse, string someoneElseHRID, string someoneElseNameCN, string someoneElseNameEN, string someoneElseTel, string someoneElseMobil, string someoneElseEmail, bool isReviewedGuideline, string otherSite, string otherCountry, Nullables.NullableDateTime requestedDateFrom, Nullables.NullableDateTime requestedDateTo, Nullables.NullableDateTime alternateDateFrom, Nullables.NullableDateTime alternateDateTo, string activity, bool isTransition, string others, string summary, string allDept, bool isDomestic, string domesticList, string overseaList, Nullables.NullableDateTime requestDate, string eRPNO, bool isSSME,bool isEBD,bool isESC, bool bUHeadApproved, bool needEVPApproval, string costCenterName, Employee requesterNo, DicItem costCenterCode, Employee someoneElseNo, LegalEntity legalEntity, Department departmentName, DicItem departmentType,string reasonOfLocation)
		{
			this._appNo = appNo;
			this._applicationType = applicationType;
			this._eZVisitReqNo = eZVisitReqNo;
			this._lGDNo = lGDNo;
			this._requesterNameCN = requesterNameCN;
			this._requesterNameEN = requesterNameEN;
			this._requesterDept = requesterDept;
			this._account = account;
			this._cATBranch = cATBranch;
			this._requesterOfficeTel = requesterOfficeTel;
			this._requesterMobile = requesterMobile;
			this._applyForSomeoneElse = applyForSomeoneElse;
			this._someoneElseHRID = someoneElseHRID;
			this._someoneElseNameCN = someoneElseNameCN;
			this._someoneElseNameEN = someoneElseNameEN;
			this._someoneElseTel = someoneElseTel;
			this._someoneElseMobil = someoneElseMobil;
			this._someoneElseEmail = someoneElseEmail;
			this._isReviewedGuideline = isReviewedGuideline;
			this._otherSite = otherSite;
			this._otherCountry = otherCountry;
			this._requestedDateFrom = requestedDateFrom;
			this._requestedDateTo = requestedDateTo;
			this._alternateDateFrom = alternateDateFrom;
			this._alternateDateTo = alternateDateTo;
			this._activity = activity;
			this._isTransition = isTransition;
			this._others = others;
			this._summary = summary;
			this._allDept = allDept;
			this._isDomestic = isDomestic;
			this._domesticList = domesticList;
			this._overseaList = overseaList;
			this._requestDate = requestDate;
			this._eRPNO = eRPNO;
			this._isSSME = isSSME;
			this._isEBD = isEBD;
			this._isESC = isESC;
			this._bUHeadApproved = bUHeadApproved;
			this._needEVPApproval = needEVPApproval;
			this._costCenterName = costCenterName;
			this._requesterNo = requesterNo;
			this._costCenterCode = costCenterCode;
			this._someoneElseNo = someoneElseNo;
			this._legalEntity = legalEntity;
			this._departmentName = departmentName;
			this._departmentType = departmentType;
			this._reasonOfLocation = reasonOfLocation;
		}

		#endregion

		#region Public Properties

		public int Id
		{
			get {return _id;}
			set {_id = value;}
		}

		public string AppNo
		{
			get { return _appNo; }
			set
			{
				if ( value != null && value.Length > 40)
					throw new ArgumentOutOfRangeException("Invalid value for AppNo", value, value.ToString());
				_appNo = value;
			}
		}

		public string ApplicationType
		{
			get { return _applicationType; }
			set
			{
				if ( value != null && value.Length > 20)
					throw new ArgumentOutOfRangeException("Invalid value for ApplicationType", value, value.ToString());
				_applicationType = value;
			}
		}

		public string EZVisitReqNo
		{
			get { return _eZVisitReqNo; }
			set
			{
				if ( value != null && value.Length > 20)
					throw new ArgumentOutOfRangeException("Invalid value for EZVisitReqNo", value, value.ToString());
				_eZVisitReqNo = value;
			}
		}

		public string LGDNo
		{
			get { return _lGDNo; }
			set
			{
				if ( value != null && value.Length > 20)
					throw new ArgumentOutOfRangeException("Invalid value for LGDNo", value, value.ToString());
				_lGDNo = value;
			}
		}

		public string RequesterNameCN
		{
			get { return _requesterNameCN; }
			set
			{
				if ( value != null && value.Length > 250)
					throw new ArgumentOutOfRangeException("Invalid value for RequesterNameCN", value, value.ToString());
				_requesterNameCN = value;
			}
		}

		public string RequesterNameEN
		{
			get { return _requesterNameEN; }
			set
			{
				if ( value != null && value.Length > 250)
					throw new ArgumentOutOfRangeException("Invalid value for RequesterNameEN", value, value.ToString());
				_requesterNameEN = value;
			}
		}

		public string RequesterDept
		{
			get { return _requesterDept; }
			set
			{
				if ( value != null && value.Length > 50)
					throw new ArgumentOutOfRangeException("Invalid value for RequesterDept", value, value.ToString());
				_requesterDept = value;
			}
		}

		public string Account
		{
			get { return _account; }
			set
			{
				if ( value != null && value.Length > 50)
					throw new ArgumentOutOfRangeException("Invalid value for Account", value, value.ToString());
				_account = value;
			}
		}

		public string CATBranch
		{
			get { return _cATBranch; }
			set
			{
				if ( value != null && value.Length > 50)
					throw new ArgumentOutOfRangeException("Invalid value for CATBranch", value, value.ToString());
				_cATBranch = value;
			}
		}

		public string RequesterOfficeTel
		{
			get { return _requesterOfficeTel; }
			set
			{
				if ( value != null && value.Length > 50)
					throw new ArgumentOutOfRangeException("Invalid value for RequesterOfficeTel", value, value.ToString());
				_requesterOfficeTel = value;
			}
		}

		public string RequesterMobile
		{
			get { return _requesterMobile; }
			set
			{
				if ( value != null && value.Length > 50)
					throw new ArgumentOutOfRangeException("Invalid value for RequesterMobile", value, value.ToString());
				_requesterMobile = value;
			}
		}

		public bool ApplyForSomeoneElse
		{
			get { return _applyForSomeoneElse; }
			set { _applyForSomeoneElse = value; }
		}

		public string SomeoneElseHRID
		{
			get { return _someoneElseHRID; }
			set
			{
				if ( value != null && value.Length > 50)
					throw new ArgumentOutOfRangeException("Invalid value for SomeoneElseHRID", value, value.ToString());
				_someoneElseHRID = value;
			}
		}

		public string SomeoneElseNameCN
		{
			get { return _someoneElseNameCN; }
			set
			{
				if ( value != null && value.Length > 250)
					throw new ArgumentOutOfRangeException("Invalid value for SomeoneElseNameCN", value, value.ToString());
				_someoneElseNameCN = value;
			}
		}

		public string SomeoneElseNameEN
		{
			get { return _someoneElseNameEN; }
			set
			{
				if ( value != null && value.Length > 250)
					throw new ArgumentOutOfRangeException("Invalid value for SomeoneElseNameEN", value, value.ToString());
				_someoneElseNameEN = value;
			}
		}

		public string SomeoneElseTel
		{
			get { return _someoneElseTel; }
			set
			{
				if ( value != null && value.Length > 50)
					throw new ArgumentOutOfRangeException("Invalid value for SomeoneElseTel", value, value.ToString());
				_someoneElseTel = value;
			}
		}

		public string SomeoneElseMobil
		{
			get { return _someoneElseMobil; }
			set
			{
				if ( value != null && value.Length > 50)
					throw new ArgumentOutOfRangeException("Invalid value for SomeoneElseMobil", value, value.ToString());
				_someoneElseMobil = value;
			}
		}

		public string SomeoneElseEmail
		{
			get { return _someoneElseEmail; }
			set
			{
				if ( value != null && value.Length > 250)
					value = value.Substring(0, 250 );
				_someoneElseEmail = value;
			}
		}

		public bool IsReviewedGuideline
		{
			get { return _isReviewedGuideline; }
			set { _isReviewedGuideline = value; }
		}

		public string OtherSite
		{
			get { return _otherSite; }
			set
			{
				if ( value != null && value.Length > 500)
					value = value.Substring(0, 500 );
				_otherSite = value;
			}
		}

		public string OtherCountry
		{
			get { return _otherCountry; }
			set
			{
				if ( value != null && value.Length > 500)
					value = value.Substring(0, 500 );
				_otherCountry = value;
			}
		}

		public Nullables.NullableDateTime RequestedDateFrom
		{
			get { return _requestedDateFrom; }
			set { _requestedDateFrom = value; }
		}

		public Nullables.NullableDateTime RequestedDateTo
		{
			get { return _requestedDateTo; }
			set { _requestedDateTo = value; }
		}

		public Nullables.NullableDateTime AlternateDateFrom
		{
			get { return _alternateDateFrom; }
			set { _alternateDateFrom = value; }
		}

		public Nullables.NullableDateTime AlternateDateTo
		{
			get { return _alternateDateTo; }
			set { _alternateDateTo = value; }
		}

		public string Activity
		{
			get { return _activity; }
			set
			{
				if ( value != null && value.Length > 200)
					throw new ArgumentOutOfRangeException("Invalid value for Activity", value, value.ToString());
				_activity = value;
			}
		}

		public bool IsTransition
		{
			get { return _isTransition; }
			set { _isTransition = value; }
		}

		public string Others
		{
			get { return _others; }
			set
			{
				if ( value != null && value.Length > 1000)
					throw new ArgumentOutOfRangeException("Invalid value for Others", value, value.ToString());
				_others = value;
			}
		}

		public string Summary
		{
			get { return _summary; }
			set
			{
				if ( value != null && value.Length > 2000)
					value = value.Substring(0, 2000 );
				_summary = value;
			}
		}

		public string AllDept
		{
			get { return _allDept; }
			set
			{
				if ( value != null && value.Length > 50)
					throw new ArgumentOutOfRangeException("Invalid value for AllDept", value, value.ToString());
				_allDept = value;
			}
		}

		public bool IsDomestic
		{
			get { return _isDomestic; }
			set { _isDomestic = value; }
		}

		public string DomesticList
		{
			get { return _domesticList; }
			set
			{
				if ( value != null && value.Length > 50)
					throw new ArgumentOutOfRangeException("Invalid value for DomesticList", value, value.ToString());
				_domesticList = value;
			}
		}

		public string OverseaList
		{
			get { return _overseaList; }
			set
			{
				if ( value != null && value.Length > 50)
					throw new ArgumentOutOfRangeException("Invalid value for OverseaList", value, value.ToString());
				_overseaList = value;
			}
		}

		public Nullables.NullableDateTime RequestDate
		{
			get { return _requestDate; }
			set { _requestDate = value; }
		}

		public string ERPNO
		{
			get { return _eRPNO; }
			set
			{
				if ( value != null && value.Length > 50)
					throw new ArgumentOutOfRangeException("Invalid value for ERPNO", value, value.ToString());
				_eRPNO = value;
			}
		}

		public bool IsSSME
		{
			get { return _isSSME; }
			set { _isSSME = value; }
		}

		public bool IsEBD
		{
			get { return _isEBD; }
			set { _isEBD = value; }
		}

		public bool IsESC
		{
			get { return _isESC; }
			set { _isESC = value; }
		}

		public bool BUHeadApproved
		{
			get { return _bUHeadApproved; }
			set { _bUHeadApproved = value; }
		}

		public bool NeedEVPApproval
		{
			get { return _needEVPApproval; }
			set { _needEVPApproval = value; }
		}

		public string CostCenterName
		{
			get{ return this._costCenterName;}
			set{	this._costCenterName = value;	}
		}

		public string ReasonOfLocation
		{
			get { return this._reasonOfLocation; }
			set{ this._reasonOfLocation = value;}
		}

		public Employee RequesterNo
		{
			get { return _requesterNo; }
			set { _requesterNo = value; }
		}

		public DicItem CostCenterCode
		{
			get { return _costCenterCode; }
			set { _costCenterCode = value; }
		}

		public Employee SomeoneElseNo
		{
			get { return _someoneElseNo; }
			set { _someoneElseNo = value; }
		}

		public LegalEntity LegalEntity
		{
			get { return _legalEntity; }
			set { _legalEntity = value; }
		}

		public Department DepartmentName
		{
			get { return _departmentName; }
			set { _departmentName = value; }
		}

		public DicItem DepartmentType
		{
			get { return _departmentType; }
			set { _departmentType = value; }
		}

		public IList PaymentInfos
		{
			get
			{
				if (_paymentInfos==null)
				{
					_paymentInfos = new ArrayList();
				}
				return _paymentInfos;
			}
			set { _paymentInfos = value; }
		}

		public IList CustomerSurveys
		{
			get
			{
				if (_customerSurveys==null)
				{
					_customerSurveys = new ArrayList();
				}
				return _customerSurveys;
			}
			set { _customerSurveys = value; }
		}

		public IList LogisticalInfos
		{
			get
			{
				if (_logisticalInfos==null)
				{
					_logisticalInfos = new ArrayList();
				}
				return _logisticalInfos;
			}
			set { _logisticalInfos = value; }
		}

		public IList Topicses
		{
			get
			{
				if (_topicses==null)
				{
					_topicses = new ArrayList();
				}
				return _topicses;
			}
			set { _topicses = value; }
		}

		public IList Emails
		{
			get
			{
				if (_emails==null)
				{
					_emails = new ArrayList();
				}
				return _emails;
			}
			set { _emails = value; }
		}

		public IList CustomerInfos
		{
			get
			{
				if (_customerInfos==null)
				{
					_customerInfos = new ArrayList();
				}
				return _customerInfos;
			}
			set { _customerInfos = value; }
		}

		public IList ContractInfos
		{
			get
			{
				if (_contractInfos==null)
				{
					_contractInfos = new ArrayList();
				}
				return _contractInfos;
			}
			set { _contractInfos = value; }
		}

		public IList BusinessPurposes
		{
			get
			{
				if (_businessPurposes==null)
				{
					_businessPurposes = new ArrayList();
				}
				return _businessPurposes;
			}
			set { _businessPurposes = value; }
		}

		public IList Attachments
		{
			get
			{
				if (_attachments==null)
				{
					_attachments = new ArrayList();
				}
				return _attachments;
			}
			set { _attachments = value; }
		}

		public IList FlowMembers
		{
			get
			{
				if (_flowMembers==null)
				{
					_flowMembers = new ArrayList();
				}
				return _flowMembers;
			}
			set { _flowMembers = value; }
		}

		public IList AppVisitingSites
		{
			get
			{
				if (_appVisitingSites==null)
				{
					_appVisitingSites = new ArrayList();
				}
				return _appVisitingSites;
			}
			set { _appVisitingSites = value; }
		}

		public IList ALAttendees
		{
			get
			{
				if (_aLAttendees==null)
				{
					_aLAttendees = new ArrayList();
				}
				return _aLAttendees;
			}
			set { _aLAttendees = value; }
		}

		public IList SalesTeamInfos
		{
			get
			{
				if (_salesTeamInfos==null)
				{
					_salesTeamInfos = new ArrayList();
				}
				return _salesTeamInfos;
			}
			set { _salesTeamInfos = value; }
		}

		public IList FlowInstances
		{
			get
			{
				if (_flowInstances==null)
				{
					_flowInstances = new ArrayList();
				}
				return _flowInstances;
			}
			set { _flowInstances = value; }
		}

		public IList EVMeetings
		{
			get
			{
				if (_eVMeetings==null)
				{
					_eVMeetings = new ArrayList();
				}
				return _eVMeetings;
			}
			set { _eVMeetings = value; }
		}

		public IList ActionLogs
		{
			get
			{
				if (_actionLogs==null)
				{
					_actionLogs = new ArrayList();
				}
				return _actionLogs;
			}
			set { _actionLogs = value; }
		}

        public static String SortExpression
        {
            get { return _sortExpression; }
            set { _sortExpression = value; }
        }

        public static SortDirection SortDirection
        {
            get { return _sortDirection; }
            set { _sortDirection = value; }
        }
		#endregion
		
        #region IComparable Methods
        public int CompareTo(object obj)
        {
			if (!(obj is Application))
				throw new InvalidCastException("This object is not of type Application");
			
			int relativeValue;
			switch (SortExpression)
			{
				case "Id":
					relativeValue = this.Id.CompareTo(((Application)obj).Id);
					break;
				case "AppNo":
					relativeValue = this.AppNo.CompareTo(((Application)obj).AppNo);
					break;
				case "ApplicationType":
						relativeValue = ( this.ApplicationType != null ) ? this.ApplicationType.CompareTo(((Application)obj).ApplicationType) : -1;
					break;
				case "EZVisitReqNo":
						relativeValue = ( this.EZVisitReqNo != null ) ? this.EZVisitReqNo.CompareTo(((Application)obj).EZVisitReqNo) : -1;
					break;
				case "LGDNo":
						relativeValue = ( this.LGDNo != null ) ? this.LGDNo.CompareTo(((Application)obj).LGDNo) : -1;
					break;
				case "RequesterNameCN":
						relativeValue = ( this.RequesterNameCN != null ) ? this.RequesterNameCN.CompareTo(((Application)obj).RequesterNameCN) : -1;
					break;
				case "RequesterNameEN":
						relativeValue = ( this.RequesterNameEN != null ) ? this.RequesterNameEN.CompareTo(((Application)obj).RequesterNameEN) : -1;
					break;
				case "RequesterDept":
						relativeValue = ( this.RequesterDept != null ) ? this.RequesterDept.CompareTo(((Application)obj).RequesterDept) : -1;
					break;
				case "Account":
						relativeValue = ( this.Account != null ) ? this.Account.CompareTo(((Application)obj).Account) : -1;
					break;
				case "CATBranch":
						relativeValue = ( this.CATBranch != null ) ? this.CATBranch.CompareTo(((Application)obj).CATBranch) : -1;
					break;
				case "RequesterOfficeTel":
						relativeValue = ( this.RequesterOfficeTel != null ) ? this.RequesterOfficeTel.CompareTo(((Application)obj).RequesterOfficeTel) : -1;
					break;
				case "RequesterMobile":
						relativeValue = ( this.RequesterMobile != null ) ? this.RequesterMobile.CompareTo(((Application)obj).RequesterMobile) : -1;
					break;
				case "ApplyForSomeoneElse":
					relativeValue = this.ApplyForSomeoneElse.CompareTo(((Application)obj).ApplyForSomeoneElse);
					break;
				case "SomeoneElseHRID":
						relativeValue = ( this.SomeoneElseHRID != null ) ? this.SomeoneElseHRID.CompareTo(((Application)obj).SomeoneElseHRID) : -1;
					break;
				case "SomeoneElseNameCN":
						relativeValue = ( this.SomeoneElseNameCN != null ) ? this.SomeoneElseNameCN.CompareTo(((Application)obj).SomeoneElseNameCN) : -1;
					break;
				case "SomeoneElseNameEN":
						relativeValue = ( this.SomeoneElseNameEN != null ) ? this.SomeoneElseNameEN.CompareTo(((Application)obj).SomeoneElseNameEN) : -1;
					break;
				case "SomeoneElseTel":
						relativeValue = ( this.SomeoneElseTel != null ) ? this.SomeoneElseTel.CompareTo(((Application)obj).SomeoneElseTel) : -1;
					break;
				case "SomeoneElseMobil":
						relativeValue = ( this.SomeoneElseMobil != null ) ? this.SomeoneElseMobil.CompareTo(((Application)obj).SomeoneElseMobil) : -1;
					break;
				case "SomeoneElseEmail":
						relativeValue = ( this.SomeoneElseEmail != null ) ? this.SomeoneElseEmail.CompareTo(((Application)obj).SomeoneElseEmail) : -1;
					break;
				case "IsReviewedGuideline":
					relativeValue = this.IsReviewedGuideline.CompareTo(((Application)obj).IsReviewedGuideline);
					break;
				case "OtherSite":
						relativeValue = ( this.OtherSite != null ) ? this.OtherSite.CompareTo(((Application)obj).OtherSite) : -1;
					break;
				case "OtherCountry":
						relativeValue = ( this.OtherCountry != null ) ? this.OtherCountry.CompareTo(((Application)obj).OtherCountry) : -1;
					break;
				case "RequestedDateFrom":
						relativeValue = ( this.RequestedDateFrom != null ) ? this.RequestedDateFrom.CompareTo(((Application)obj).RequestedDateFrom) : -1;
					break;
				case "RequestedDateTo":
						relativeValue = ( this.RequestedDateTo != null ) ? this.RequestedDateTo.CompareTo(((Application)obj).RequestedDateTo) : -1;
					break;
				case "AlternateDateFrom":
						relativeValue = ( this.AlternateDateFrom != null ) ? this.AlternateDateFrom.CompareTo(((Application)obj).AlternateDateFrom) : -1;
					break;
				case "AlternateDateTo":
						relativeValue = ( this.AlternateDateTo != null ) ? this.AlternateDateTo.CompareTo(((Application)obj).AlternateDateTo) : -1;
					break;
				case "Activity":
						relativeValue = ( this.Activity != null ) ? this.Activity.CompareTo(((Application)obj).Activity) : -1;
					break;
				case "IsTransition":
						relativeValue = ( this.IsTransition != Convert.ToBoolean( null) ) ? this.IsTransition.CompareTo(((Application)obj).IsTransition) : -1;				
					break;
				case "Others":
						relativeValue = ( this.Others != null ) ? this.Others.CompareTo(((Application)obj).Others) : -1;
					break;
				case "Summary":
						relativeValue = ( this.Summary != null ) ? this.Summary.CompareTo(((Application)obj).Summary) : -1;
					break;
				case "AllDept":
						relativeValue = ( this.AllDept != null ) ? this.AllDept.CompareTo(((Application)obj).AllDept) : -1;
					break;
				case "IsDomestic":
						relativeValue = ( this.IsDomestic != Convert.ToBoolean( null) ) ? this.IsDomestic.CompareTo(((Application)obj).IsDomestic) : -1;				
					break;
				case "DomesticList":
						relativeValue = ( this.DomesticList != null ) ? this.DomesticList.CompareTo(((Application)obj).DomesticList) : -1;
					break;
				case "OverseaList":
						relativeValue = ( this.OverseaList != null ) ? this.OverseaList.CompareTo(((Application)obj).OverseaList) : -1;
					break;
				case "RequestDate":
						relativeValue = ( this.RequestDate != null ) ? this.RequestDate.CompareTo(((Application)obj).RequestDate) : -1;
					break;
				case "ERPNO":
						relativeValue = ( this.ERPNO != null ) ? this.ERPNO.CompareTo(((Application)obj).ERPNO) : -1;
					break;
				case "IsSSME":
						relativeValue = ( this.IsSSME != Convert.ToBoolean( null) ) ? this.IsSSME.CompareTo(((Application)obj).IsSSME) : -1;				
					break;
				case "IsEBD":
					relativeValue = ( this.IsEBD != Convert.ToBoolean( null) ) ? this.IsEBD.CompareTo(((Application)obj).IsEBD) : -1;				
					break;
				case "IsESC":
					relativeValue = ( this.IsESC != Convert.ToBoolean( null) ) ? this.IsESC.CompareTo(((Application)obj).IsESC) : -1;				
					break;
				case "BUHeadApproved":
						relativeValue = ( this.BUHeadApproved != Convert.ToBoolean( null) ) ? this.BUHeadApproved.CompareTo(((Application)obj).BUHeadApproved) : -1;				
					break;
				case "NeedEVPApproval":
						relativeValue = ( this.NeedEVPApproval != Convert.ToBoolean( null) ) ? this.NeedEVPApproval.CompareTo(((Application)obj).NeedEVPApproval) : -1;				
					break;
				case "CostCenterName":
					relativeValue = ( this.CostCenterName != null ) ? this.ERPNO.CompareTo(((Application)obj).CostCenterName) : -1;
					break;
				case "ReasonOfLocation":
					relativeValue = ( this.ReasonOfLocation != null ) ? this.ReasonOfLocation.CompareTo(((Application)obj).ReasonOfLocation) : -1;
					break;
                default:
                    goto case "Id";
			}
            if (Application.SortDirection == SortDirection.Ascending)
				relativeValue *= -1;
			return relativeValue;
		}
		#endregion
	}

	#endregion
}
